#defines
CPPFLAGS = -Wall -D_LINUX_ -fPIC -I /usr/include/libxml2
CPP = g++
HEADERS = ../LibUtil.h
LIBS = libLibUtil.so
LDFLAGS = -shared -Wl,-soname,$(LIBS) -lpthread -lcurl -lz
VERSION ?= 1.0.0
DEBUG ?= FALSE

ifeq ($(DEBUG), TRUE)
CPPFLAGS += -g -D_DEBUG
else
CPPFLAGS += -O2
endif

OBJS += \
	ConnectionManager.o \
	CURLHttpConnection.o \
	EncodingHelper.o \
	MD5HashHelper.o \
	ZLibEncryptHelper.o \
	MD5.o \
	GeneralHashFunctions.o \
	LibUtil.o \

#rules
$(OBJS) : $(HEADERS)  
%.o : %.cpp %.h
	$(CPP) -c $(CPPFLAGS) $< -o $@

$(LIBS) : $(OBJS)
	$(CPP) $(LDFLAGS) -o $(LIBS).$(VERSION) $^
	@ln -f $(LIBS).$(VERSION) $(LIBS)

.PHONY : clean
.DEFAULT : all

all : $(LIBS)

clean :
	@rm -f *.o *.so.* *.so
